/**
 * ClassName 流程挂接视图
 * */
var numStore = new Ext.data.SimpleStore
({
    fields: ["id", "pageSize"],
    data: [
        ['5', 5],
        ['10', 10],
        ['20', 20],
        ['50', 50]
    ]
});
Ext.define("core.user.view.UserGrid", {
    extend: "Ext.grid.Panel",
    alias: "widget.usergrid",
    store: "core.user.store.UserStore",
    selModel: {
        selType: "checkboxmodel"
    },
    border: 0,
    multiSelect: true,
    frame: true,
    viewConfig: {
        enableTextSelection: true//单元格内容可以被选中，便于复制
    },
    tbar: [
        {xtype: 'button', text: '新增用户', ref: 'addUser', iconCls: 'table_add'},
        {xtype: 'button', text: '修改用户', ref: 'updateUser', iconCls: 'table_edit'},
        {xtype: 'button', text: '删除用户', ref: 'removeUser', iconCls: 'table_remove'},
        "->",
        "本页用户名过滤:",
        {
            xtype: 'triggerfield',
            triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
            listeners: {
                "change": function (_this, _new, _old, _opt) {
                    var _store = _this.ownerCt.ownerCt.getStore();
                    _store.clearFilter(false);
                    _store.filter("username", _new);
                }
            },
            onTriggerClick: function () {
                var _store = this.ownerCt.ownerCt.getStore();
                _store.clearFilter(false);
                _store.filter("username", this.getValue());
            }
        }
    ],
    bbar: {
        xtype: 'pagingtoolbar',
        id: 'pagingtoolbar',
        store: 'core.user.store.UserStore',
        dock: 'bottom',
        totalProperty: "totalProperty",
        displayInfo: true,
        items: [
            {
                xtype: 'combobox',
                width: 45,
                forceSelection: true,
                mode: 'local',
                store: numStore,
                displayField: 'id',
                valueField: 'pageSize',
                ref: 'uPageSize',
                value: 10
            }]

    },
    enableKeyNav: true,  //可以使用键盘控制上下
    columnLines: true, //展示竖线
    columns: [
        {xtype: 'rownumberer'},
        {text: "用户ID", dataIndex: "userId", width: 100, border: 50},
        {text: "用户名", dataIndex: "username", width: 100, border: 50},
        {
            text: "密 码", dataIndex: "password", width: 60,
            renderer: function (v) {
                return "*****";//
            }
        },
        {
            text: "性别", dataIndex: "sex", width: 40, renderer: function (v) {
            if (v == "男") {
                return "<font color=green>男</font>";
            } else if (v == "女") {
                return "<font color=red>女</font>";//
            }

        }
        },
        {text: "电话", dataIndex: "phone", width: 100},
        {text: "QQ", dataIndex: "qq", width: 80},
        {text: "Email", dataIndex: "email", width: 120},
        {text: "地址", dataIndex: "address", width: 220},
        {text: "注册时间", dataIndex: "regTime", width: 120, emptyCellText: 'ggfd'},
        {text: "最后更新时间", dataIndex: "updateTime", width: 120, emptyCellText: 'ggfd'}

    ],
    initComponent: function () {
        this.callParent(arguments);
    }
});